#!/usr/bin/lua
--[[
-- this is a typical FCGI application and/or launcher
-- for apache mod_fastcgi, replace the above shebang to point
-- the the correct lua(even on Windows, say c:/lua5.1/lua.exe)
--]]
require'lfcgi'
local i = 0
while lfcgi.accept() >= 0 do
  lfcgi.stdout:write('Content-Type: text/plain\r\n\r\n')
  i = i + 1
  lfcgi.stdout:write("process id ", lfcgi.getpid(), " run ", i, "\r\n")
  for k,v in pairs(lfcgi.environ()) do print(k,v) end
end
